package net.qiqbframework.eventhandling;


import net.qiqbframework.common.Registration;
import net.qiqbframework.messaging.intercepting.MessageDispatchInterceptorSupport;
import net.qiqbframework.messaging.MessageHandler;
import net.qiqbframework.messaging.SubscribableMessageSource;

import javax.annotation.Nonnull;

/**
 * 事件总线
 */
public interface EventBus extends SubscribableMessageSource<EventMessage<?>>, MessageDispatchInterceptorSupport<EventMessage<?>> {


    /**
     *
     * @param
     */
    void publish(EventMessage<?> event);


    Registration subscribe(@Nonnull String eventName, @Nonnull MessageHandler<? super EventMessage<?>> handler);

}
